﻿using System;
using System.Collections.Generic;
using System.Text;

namespace RemoteObject
{
    public class DistributeRequestor
    {
        string remoteFile;
        string localFile;
        RemoteObject.RemoteObjectDownloader robj;
        private long jobID;
        private string localPort;

        public DistributeRequestor(string fnRemote, string fnLocal, string localPort)
        {
            remoteFile = fnRemote;
            localFile = fnLocal;
            this.localPort = localPort;
            robj = (RemoteObject.RemoteObjectDownloader)Activator.GetObject(typeof(RemoteObject.RemoteObjectDownloader), Common.CloudServerURL);
            jobID = robj.GetNewClientID();
        }

        public void Run()
        {
            robj.DistributeRequest(localFile, remoteFile, String.Format("tcp://{0}:{1}/RemoteObject.RemoteObjectDownloader", Common.LocalIPAddress, localPort), jobID);
        }
    }
}
